<template>
  <div>
    <h4>{{ title }}</h4>
    <ul>
      <li v-for="item in newGoodsList" :key="item.id" @click="getGoods(item)">
        <img
          :src="item.list_pic_url"
          alt=""
          width="100%"
          style="display: block"
        />
        <div class="title">{{ item.name }}</div>
        <div class="price">{{ item.retail_price | filtermoney }}</div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "ProHome",
  props: ["newGoodsList", "title"],
  methods: {
    getGoods(item) {
      this.$router.push(`/productdetail/${item.id}`);
    },
  },
};
</script>

<style lang="less" scoped>
h4 {
  text-align: center;
  height: 50px;
  background: red;
  line-height: 50px;
  font-size: 18px;
  background-color: #fff;
  font-weight: 400;
}
ul {
  padding: 0.1rem 2%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  background-color: #fff;
  text-align: center;
  > li {
    width: 49%;
    > img {
      width: 100%;
    }
    > .money {
      color: darkred;
    }
  }
}
</style>